Use pidfd_send_signal under the hood#4666
Merged
lifubang merged 2 commits intoopencontainers:mainfrom Mar 8, 2025
Merged
Conversation
Because we should switch to unix.PidFDSendSignal in new kernels, it has been supported in go runtime. We don't need to add fall back to unix.Kill code here. Signed-off-by: lifubang <lifubang@acmcoder.com> Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
c7ba051 to
71f1362
Compare
rata
approved these changes
Mar 7, 2025
Member
rata
left a comment
There was a problem hiding this comment.
LGTM, thanks!
Just curious, which go version is the min for this to use pidfd?
Contributor
Author
This is in Go 1.23 (see golang/go#62654 for a high-level overview). |
Contributor
Author
The gist of the implementation is in https://go-review.googlesource.com/c/go/+/570036; pidfd will be used when the kernel has all needed support (and it is not blocked by e.g. selinux) -- this means Linux v5.4 or so. |
lifubang
reviewed
Mar 8, 2025
71f1362 to
3058ed0
Compare
This way, given a recent Go and Linux version, pidfd_send_signal will be used under the hood. Keep unix.Signal and unix.SignalName for logging (it is way more readable than what os.Signal.String() provides). Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
3058ed0 to
1afa1b8
Compare
lifubang
reviewed
Mar 8, 2025
lifubang
reviewed
Mar 8, 2025
lifubang
approved these changes
Mar 8, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This carries the first commit from #4517, and adds another patch on top of it.
The sole reason is to use pidfd_send_signal under the hood, if that's available.